# -*- encoding:utf-8  -*-
import socket

import sys

if __name__ == '__main__':
    host = "127.0.0.1"
    port = 12000
    client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    client.connect((host, port))

    while True:
        msg = raw_input('input message to server:')
        if msg != "exit":
            client.send(msg)
            rev = client.recv(2048)
            if rev is not None:
                print rev
        else:
            client.close()
            sys.exit(0)
